package com.guli.educms.controller;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.guli.commonutils.R;
import com.guli.educms.bean.CrmBanner;
import com.guli.educms.service.CrmBannerService;
import org.apache.poi.hssf.record.CRNCountRecord;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @ClassName BannerFrontController
 * @Description TODO
 * @Author YinLiangTao Email:1517535831@qq.com
 * @Date 2022/4/10 15:04
 * @Version 1.0
 */
@RestController
@CrossOrigin
@RequestMapping("/educms/banner")
public class BannerFrontController {

    @Resource
    private CrmBannerService crmBannerService;

    @GetMapping("getAllBanner")
    public R getAllBanner(){
        QueryWrapper<CrmBanner> wrapper = new QueryWrapper<>();
        wrapper.orderByDesc("id").last("limit 2");
        List<CrmBanner> bannerList = crmBannerService.getAllBanner();
       return R.ok().data("bannerList",bannerList);
    }
}
